﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ASmile.Extend
{
    public static class NumberExtend
    {
        public static string NumToString(long src, int minLen)
        {
            StringBuilder sb = new StringBuilder();
            for (long i = 0; i < minLen; i++)
            {
                sb.Append("0");
            }
            return src.ToString(sb.ToString());
        }

        public static string ToString(this int src, int minLen)
        {
            return NumToString(src, minLen);
        }

        public static string ToString(this long src, int minLen)
        {
            return NumToString(src, minLen);
        }

        public static string ToString(this decimal src, int minLen)
        {
            return NumToString((long)src, minLen);
        }

        public static string ToString(this float src, int minLen)
        {
            return NumToString((long)src, minLen);
        }
    }
}
